﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NVelocity;
using Enterprise.Utility;
using Enterprise.Factorys;
using Enterprise.Bll.Contract;
using Enterprise.Model;
using System.Xml.Linq;


namespace Enterprise.Web
{
    public partial class _Default : System.Web.UI.Page
    {
        private static string _templateFileName = "index.html";
        private string[] cssFileUrlList;
        INews inews = Factorys.GetBllImplement.GetNews();
        protected void Page_Load(object sender, EventArgs e)
        { 
            cssFileUrlList= SiteUtility.GetCssFileUrlList();
            BindNotices();
        }
        protected void BindNotices()
        {
            IEnumerable<News> newlist = null;
            newlist =ModelConvertHelper<News>.ToModels(inews.GetArticleList(1,5));
            var obj = new VelocityHelper("~/Template", System.Text.Encoding.GetEncoding("UTF-8"));
            obj.Put("newlist",newlist);
            obj.Put("CssFileUrlList",cssFileUrlList);
            obj.Put("resRootPath", SiteUtility.GetResRootPath());
            obj.Display(_templateFileName);
        }
      
    }
}
